package com.cafe.service.impl;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cafe.dao.OrderDao;
import com.cafe.model.Order;
import com.cafe.service.OrderService;
import com.malamute.core.common.Page;

/**
 * @description 订单业务接口实现类
 * @version v1.0
 */
@Service
public class OrderServiceImpl implements OrderService {
	@Autowired
	private OrderDao orderDao;

	/*
	 * (non-Javadoc)
	 * 
	 * @param order
	 * 
	 * @see com.cafe.service.OrderService#saveOrder(com.cafe.model.Order)
	 */
	@Override
	public void saveOrder(Order order) {
		orderDao.save(order);

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @param order
	 * 
	 * @see com.cafe.service.OrderService#updateOrder(com.cafe.model.Order)
	 */
	@Override
	public void updateOrder(Order order) {
		orderDao.update(order);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @param criteria
	 * 
	 * @param page
	 * 
	 * @see
	 * com.cafe.service.OrderService#listOrdersByPage(org.hibernate.criterion
	 * .DetachedCriteria, com.malamute.core.common.Page)
	 */
	@Override
	public void listOrdersByPage(DetachedCriteria criteria, Page page) {
		orderDao.listByPage(criteria, page);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @param id
	 * 
	 * @return
	 * 
	 * @see com.cafe.service.OrderService#getOrderById(java.lang.Integer)
	 */
	@Override
	public Order getOrderById(Integer id) {
		return orderDao.get(id);
	}

}
